// ==================================================
// Copyright 2014 (C) , dotLogix
// Author: Alexander Schill <alexander@schillnet.de>.
// ==================================================

namespace DotLogix {
    #region Using Directives
    using System.Windows.Input;
    using System.Windows.Media;

    #endregion

    public class AutoSizeHoverButton : AutoSizeTextWithBackground {
        protected Brush _background;
        protected Brush _hover;
        private bool _isHover;

        public Brush Hover {
            get { return _hover; }
            set {
                _hover = value;
                if(!_isHover)
                    return;
                base.Background = value;
            }
        }

        public new Brush Background {
            get { return _background; }
            set {
                _background = value;
                if(_isHover)
                    return;
                base.Background = value;
            }
        }

        protected override void OnMouseEnter(MouseEventArgs e) {
            _isHover = true;
            base.Background = Hover;
        }

        protected override void OnMouseLeave(MouseEventArgs e) {
            _isHover = false;
            base.Background = Background;
        }
    }
}